﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
using System.IO;

namespace Mapeo
{
    public class Controlador
    {
        protected static Configuration m_Configuration = new Configuration();
        protected static ISessionFactory m_SessionFactory;
        public static Boolean mapeado = false;
        public Object m_ObjectFlow;

        public Controlador() { }


        public virtual void Start()
        {
            // All code here.
            
        }

        public static void LoadConfiguration()
        {
            try
            {
                String pat = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory);
                m_Configuration.Configure(pat+"hibernate.cfg.xml");
                m_SessionFactory = m_Configuration.BuildSessionFactory();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public static ISessionFactory ObtenerSesion()
        {
            try
            {
                return m_SessionFactory;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }


    }
}
